//
//  AXMyEditAddressVC.m
//  AnXin100
//
//  Created by 天质弘耕 on 2018/11/14.
//  Copyright © 2018 tzhg. All rights reserved.
//

#import "AXMyEditAddressVC.h"
#import "AXMyEditAddressNameCell.h"
#import "AXMyEditAddressSexCell.h"
#import "AXMyEditAddressHarvestAddressCell.h"


@interface AXMyEditAddressVC ()<UITableViewDelegate, UITableViewDataSource>

@property (nonatomic , strong) UITableView *tableview;

@end

@implementation AXMyEditAddressVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    [self creatView];
    [self setlayout];
}

- (void)creatView {
    /** 表头创建 */
    self.tableview = [[UITableView alloc]init];
    self.tableview.delegate = self;
    self.tableview.dataSource = self;
    [self.tableview registerClass:[AXMyEditAddressNameCell class] forCellReuseIdentifier:[AXMyEditAddressNameCell reuseID]];
    [self.tableview registerClass:[AXMyEditAddressSexCell class] forCellReuseIdentifier:[AXMyEditAddressSexCell reuseID]];
    [self.tableview registerClass:[AXMyEditAddressHarvestAddressCell class] forCellReuseIdentifier:[AXMyEditAddressHarvestAddressCell reuseID]];
    self.tableview.tableFooterView = [UIView new];
    [self.view addSubview:self.tableview];
    
}



- (void)setlayout {
    
    self.tableview.sd_layout
    .leftSpaceToView(self.view, 0)
    .topSpaceToView(self.view, NAVIGATION_HEIGHT)
    .widthIs(Wi)
    .heightIs(TableViewHeight);
    
    
}



#pragma mark - tableview delegate & datasource

//几个分区
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
  
    return 5;
    
}

/** cell的高度 */

/** cell 自适应第二步 */
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    return 44;
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    switch (indexPath.row) {
        case 0:{
            
            AXMyEditAddressNameCell *cell3 = [tableView dequeueReusableCellWithIdentifier:[AXMyEditAddressNameCell reuseID] forIndexPath:indexPath];
            cell3.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            [cell3 setSelectionStyle:UITableViewCellSelectionStyleNone];
            cell3.inputTextField.placeholder = @"请填写收获人姓名";
            cell3.nameLabel.text = @"联系人：";
            return cell3;
        }
            break;
        case 1:{
            
            AXMyEditAddressSexCell *cell2 = [tableView dequeueReusableCellWithIdentifier:[AXMyEditAddressSexCell reuseID] forIndexPath:indexPath];
            cell2.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            [cell2 setSelectionStyle:UITableViewCellSelectionStyleNone];
            return cell2;
            
            
        }
            break;
        case 2:{
            
            AXMyEditAddressNameCell *cell3 = [tableView dequeueReusableCellWithIdentifier:[AXMyEditAddressNameCell reuseID] forIndexPath:indexPath];
            cell3.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            [cell3 setSelectionStyle:UITableViewCellSelectionStyleNone];
            cell3.inputTextField.placeholder = @"请填写收货人的s手机号码";
            cell3.nameLabel.text = @"手机号：";
            return cell3;
            
        }
            break;
        case 3:{
            AXMyEditAddressHarvestAddressCell *cell3 = [tableView dequeueReusableCellWithIdentifier:[AXMyEditAddressHarvestAddressCell reuseID] forIndexPath:indexPath];
            cell3.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            [cell3 setSelectionStyle:UITableViewCellSelectionStyleNone];
            //            cell3.inputTextField.placeholder = @"请填写收货人的s手机号码";
            cell3.nameLabel.text = @"收货地址：";
            return cell3;

        }
            break;
            
        default:
            break;
    }
    
    
    AXMyEditAddressNameCell *cell3 = [tableView dequeueReusableCellWithIdentifier:[AXMyEditAddressNameCell reuseID] forIndexPath:indexPath];
    cell3.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    [cell3 setSelectionStyle:UITableViewCellSelectionStyleNone];
    cell3.inputTextField.placeholder = @"街、门牌号";

    cell3.nameLabel.text = @"详细地址：";

    return cell3;
    
    
}



@end
